#include "myhall.h"




uint8_t Hall_Get_State(void)
{
	uint8_t temp = 0;
	temp = HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_5) | HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_1) << 1 | HAL_GPIO_ReadPin(GPIOB,GPIO_PIN_10) << 2;
//	temp = ((GPIOA->IDR >> 5) & 0x01) | (((GPIOA->IDR >> 1) & 0x01) << 1) | (((GPIOB->IDR >> 10) & 0x01) << 2);   //bit0: hall_U-PA5, bit1: hall_V-PA1, bit2: hall_W-PB10.			//TIM2
	return temp;
}

double_t Hall_SpeedMonitor_RPM(uint16_t *buf, uint8_t length)
{
    uint8_t i = 0;
    double_t sum = 0;
    for (i = 0; i<length; i++)
    {
        sum += buf[i];
    }
		return((34000000.0 * length) / sum);


}
